# -*- coding: utf-8 -*-
"""
Created on Sun Aug  1 11:16:18 2021

@author: 16016
"""

import cv2
import os

import matplotlib.pyplot as plt # 调用matplotlib绘图库
plt.rcParams['font.sans-serif'] = ['SimHei'] # 载入字体

def pshow(words,picture):
    plt.imshow(picture[:,:,::-1])   # 将读取的图片以RGB转换为BGR
    plt.title(words), plt.xticks([]), plt.yticks([])
    plt.show() # 显示图片
    
dir_name='./img'
fileimg_list = []
fileimg_list=os.listdir(dir_name)
file_num=len(fileimg_list)
i=0
while True:
    if i<file_num:
        print(i)
        img=cv2.imread(dir_name + '/' + fileimg_list[i])    
        pshow(fileimg_list[i],img)
        i=i+1
    else:
        break
